import request from '@/request'
import { C2B } from '@/utils/wordtransfer.js'

// 查询搜索并分页
export const findPages = (data) => {
    return request.post('/download/list', data)
}

// 回收站
export const findPagesRecyle = (data) => {
    return request.post('/download/recyle', data)
}

// id查询明细
export const getById = (id) => {
    return request.post(`/download/get/${id}`, {})
}

// 保存和更新
export const saveUpdate = (data) => {
    return request.post('/download/saveupdate', data)
}

// 修改状态
export const updateStatus = (id, field, value) => {
    field = C2B(field)
    return request.post(`/download/status/${id}/${field}/${value}`, {})
}

// 批量逻辑删除
export const batchDels = (ids) => {
    return request.post('/download/batch/dels', { ids })
}

// 批量逻辑恢复
export const batchRecovers = (ids) => {
    return request.post('/download/batch/recover', { ids })
}

// 批量彻底删除
export const batchRemoves = (ids) => {
    return request.post('/download/batch/remove', { ids })
}

// 批量上架
export const batchUps = (ids) => {
    return request.post('/download/batch/up', { ids })
}

// 批量下架
export const batchDowns = (ids) => {
    return request.post('/download/batch/down', { ids })
}

// 批量精华
export const batchEssences = (ids, flag) => {
    return request.post('/download/batch/essences', { ids, flag })
}

// 批量置顶
export const batchTops = (ids, flag) => {
    return request.post('/download/batch/top', { ids, flag })
}

// 物理删除
export const removeById = (id) => {
    return request.post(`/download/remove/${id}`, {})
}

//恢复删除
export const recoverById = (id) => {
    return request.post(`/download/recover/${id}`, {})
}

// 逻辑删除
export const delById = (id) => {
    return request.post(`/download/del/${id}`, {})
}
